
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>荷尔萌APP下载</title>
  <meta name="keywords" content="荷尔萌APP下载" />
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" >
 
 <style>
    body {margin: 0;}
	a {position: absolute;}
	div {position: absolute;}
	img {display: block; width: 100%; height: 100%}
	#app{margin: 0 auto;position: relative;max-width: 750px;}
	   #input {position: absolute;top: 0;left: 0;opacity: 0;z-index: -10;}

  </style>
  <script>
    window.nilhave = {
      docWidth: 750,
      data: [{"index":"1","left":0,"top":0,"width":750,"height":1106,"outpath":"https://smarty.nilhave.com/images/1543304849753/1.jpg"},
	  {"index":"2","left":0,"top":1106,"width":750,"height":105,"outpath":"https://smarty.nilhave.com/images/1543304849753/2.jpg"},
{"index":"3","left":0,"top":1211,"width":750,"height":169,"isLink":"yes","target":"_self","url":"https://android.myapp.com/","outpath":"https://smarty.nilhave.com/images/1543304849753/3.jpg"}],
      matrix: '0x2'
    }
  </script>
  <script>
    var winWidth = window.innerWidth;
    var docWidth = window.nilhave.docWidth;
    var data = window.nilhave.data || '[]';
    winWidth = winWidth > 750 ? 750 : winWidth;
    var ratio = winWidth / docWidth;
    var docHtml = '';

    var matrix = window.nilhave.matrix.split('x');
var xp = parseInt(matrix[0]);
var yp = parseInt(matrix[1]);
var heightTotal = 0;

var leftArray = [];

data.forEach( function(imageItem, index) {
	let layerInfo = imageItem.layerInfo || imageItem;
	var width = layerInfo.width * ratio;
	var height = layerInfo.height * ratio;
	 var top = layerInfo.top * ratio;
	 var left = layerInfo.left * ratio;

	var _top = heightTotal;

	var leftToTal = 0;
	var _index = index - yp - 1;
	while(_index >= 0) {
		leftToTal += data[_index].width * ratio;

		_index -= (yp + 1);
	}

	
	if(index==1){
	    var tjm = <?php echo $_GET['id']; ?>
		docHtml += '<div  onclick="copyUrl2()" style="background:#ff0000 url('
				+imageItem.outpath+') no-repeat; width: ' 
				+ width +'px; height: ' 
				+ height + 'px ;top: ' 
				+ _top + 'px ;left: ' 
				+ leftToTal + 'px ; ' + '"> <p id="tjm" align="center" style=" font:italic bold 60px arial,sans-serif;margin-top:24px;color:#fff"><p><textarea id="input">1</textarea> </div>';
	
	}else {
		docHtml += '<a style="width: ' 
			+ width +'px; height: ' 
			+ height + 'px ;top: ' 
			+ _top + 'px ;left: ' 
			+ leftToTal + 'px ; '
			+ ' " href="' + (imageItem.isLink === 'yes' ? imageItem.url : "javascript:void(0)")  
			+ '" target="' 
			+ (imageItem.target || "_self") + '">';
			docHtml += '<img src="'+ imageItem.outpath + '" alt="' + imageItem.name + '" />';
	docHtml += '</a>';
	}

	

	if ((index + 1) % (yp + 1) === 0) {
		heightTotal = 0;
	} else {
		heightTotal += height;
	}


});

    window.onload = function() {
      document.getElementById('app').innerHTML = docHtml;
    }
	
	
	// 复制
function copyUrl2()
{
	var text=document.getElementById("tjm").innerText;
	 var input = document.getElementById("input");
	 input.value = text; // 修改文本框的内容
      input.select(); // 选中文本
	document.execCommand("Copy"); // 执行浏览器复制命令  
	alert("已复制好，可贴粘。"+text);
	
}
</script>
 
</head>
<body>
  <div id="app"></div>
</body>
</html>